#Compiladores
CC = gcc 
ASMC = nasm

CFLAGS = -Wall -g -c  
ASMFLAGS = -t -f coff
FICHEIROS_O = main.o video-graphics.o sprite.o codepage.o video-text.o kbc.o queue.o timer.o ints.o aux_menu.o music.o wait.o kbd_isr.o

feup_defender.exe: $(FICHEIROS_O)
	$(CC) $(FICHEIROS_O) -o feup_defender.exe

main.o: main.c kbc\kbc.h kbc\kbc.c kbc\queue.h kbc\queue.c
	$(CC) $(CFLAGS) main.c
	
video-text.o: video-text\video-text.c video-text\video-text.h
	$(CC) $(CFLAGS) video-text\video-text.c
	
aux_menu.o: video-text\aux_menu.c video-text\aux_menu.h
	$(CC) $(CFLAGS) video-text\aux_menu.c
	
video-graphics.o: video-graphics\video-graphics.c video-graphics\video-graphics.h video-graphics\sprite.h utypes.h
	$(CC) $(CFLAGS) video-graphics\video-graphics.c
	
sprite.o: video-graphics\sprite.h video-graphics\sprite.c
	$(CC) $(CFLAGS) video-graphics\sprite.c

codepage.o: video-graphics\codepage.h video-graphics\codepage.c
	$(CC) $(CFLAGS) video-graphics\codepage.c
	
kbc.o: kbc\kbc.h kbc\kbc.c timer\ints.h timer\ints.c timer\timer.h timer\timer.c
	$(CC) $(CFLAGS) kbc\kbc.c
	
queue.o: kbc\queue.h kbc\queue.c
	$(CC) $(CFLAGS) kbc\queue.c

music.o: music\music.h music\music.c timer\timer.h utypes.h
	$(CC) $(CFLAGS) music\music.c
	
timer.o: timer\timer.h timer\timer.c timer\ints.h timer\ints.c
	$(CC) $(CFLAGS) timer\timer.c
	
ints.o: timer\ints.h timer\ints.c 
	$(CC) $(CFLAGS) timer\ints.c
	
kbd_isr.o: kbc\kbd_isr.asm
	$(ASMC) $(ASMFLAGS) kbc\kbd_isr.asm -o kbd_isr.o
		
wait.o: timer\wait.asm
	$(ASMC) $(ASMFLAGS) timer\wait.asm -o wait.o
	

clean:
	del *.o
	del feup_defender.exe
	